<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class Profile extends Front_Controller {

	//--------------------------------------------------------------------
	
	public function index($id = null){
		$this->load->model('model_users');
		if($id == null){
			$id = $this->session->userdata('user_id');
			$deets = $this->model_users->getUserDeets($id);
		} else {
			$name = explode("_", $id); 
			$deets = $this->model_users->getUserDeets(null,ucwords($name[0]), ucwords($name[1]));
		}
		$currentLvl = floor($deets->total_points/1000)+1;
		$nextLvlExp = ($currentLvl)*1000;
		$nextLvlProg = ($deets->total_points/$nextLvlExp)*100;

		Template::set('meta_title',"New Game Plus [".$deets->first_name.' '.$deets->last_name.']');
		Template::set('deets', $deets);
		Template::set('current_level', $currentLvl);
		Template::set('nextLvlExp', $nextLvlExp);
		Template::set('nextLvlProg', $nextLvlProg);
		Template::render();
	}
	
	//--------------------------------------------------------------------
	

}